﻿<!DOCTYPE html>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>个股详情</title>
		<link href="css/text.css" rel="stylesheet" type="text/css" />
		<style type="text/css">				
			p {margin:1px;}					
			ul {margin:1px;}			
			h4 {margin:0px}	
			#towriter{
				margin-top:-8px;
				border: 1px solid #555555;
				white-space: normal;											
			}
			.fixedBox{					
				white-space: nowrap;	 
			}
			.fixedBox::-webkit-scrollbar {
				width: 0px;     
				height: 4px;		
				background-color:#7c7c7c;				
			}		
			#chuangyeban{
				color: #2F51bF;										
			}

			#kechuangban{
				color: #356e2F;										
			}

			#zixuangu{
				color: #faa1f5;
			}
			#shangyingxian{
				color: #ffff33;
			}
			div {
				margin:0px;
				padding-left: 0px;
			}
			
		</style>		
		<script type="text/javascript" src="js/json2html.js"></script>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script>
    		var ztxq = 0;  //默认显示涨停原因(0:不显示；1:显示)
			var sdxq = 0;  //默认显示同花顺速递(0:不显示；1:显示)
			var rdxq = 0;  //默认显示东财热点(0:不显示；1:显示)

			var zdycolor = "#FF00FF";  //自定义板块颜色
			var zxgcolor = "#faa1f5";  //自选股颜色
			var syxtlcolor = "#ffff33";  //上影线套利股颜色 

			var cybcolor = "#2F51bF";  //创业板颜色
			var kcbcolor = "#356e2F";  //科创板颜色

			var ztwz='82px';  //涨停数
			var bkhex1='-13px'; //[最高连扳]
			var bkhex2='27px';  //[n天n板][最高连扳]
			var zuoribanbq='94px'; //昨日板 标签
			var lianbanbq='95px';  //连扳 标签
			var pozibq='180px';      //破 板标签
			var xifenbq='165px';   //细分标签
			var longtoubq='180px';   //地位排序标签
			var zhangf1bq='135px';     //涨幅标签位1
			var zhangf2bq='125px';     //涨幅标签位2 如果空间位置够宽，设置值和 涨幅标签位1 一样；空间窄时，有细分板块 标签显示的时候 需要 微调一下 涨幅的位置
			var shijiltbq='42px';    //实际流通市值
			
			var dt = "";
			var tt = "";
			var gt = "";
			var bka = "";
			var bkb = "";	
			var zxg = "";	
			var syx = "";

            ///自动刷新
			var intervalId; 
			function toggleAutoRefresh() {
				if (intervalId) {
					// 清除定时器
					clearInterval(intervalId);
					intervalId = null;
					//document.getElementById('refreshButton').textContent = '开启自动刷新';
				}
				else
				{
					intervalId = setInterval(function() {	
						getSource();																				
					},10000);
					//document.getElementById('refreshButton').textContent = '关闭自动刷新';
				}
			} 
			 
			
			window.onload = function() {  

				try {
					var text = load("个股详情自定义板块.txt"); 
					bka = text.split("[高亮板块]")[1].split("[过滤板块]")[0];			
					bkb = text.split("[过滤板块]")[1];	  
				} catch (error) {
					
				}

				try {
					var text1 = load("自选股.txt");  
					zxg =text1;	 
				} catch (error) {
					
				}

				try {
					var text2 = load("上影线套利.txt");  
					syx =text2;	
				} catch (error) {
					
				} 

				var day = new Date();
				gt = day.getTime();
				mymonth = day.getMonth()+1;
				myday = day.getDate();
				if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
				if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
				tt = day.getFullYear() + "-" + mymonth + "-" + myday;						
				dt = tt;
				getSource();
				changeStyle();
			}


			// $(function() {
			// 	intervalId = setInterval(function() {					
			// 		var text = load("个股详情自定义板块.txt"); 
			// 		bka = text.split("[高亮板块]")[1].split("[过滤板块]")[0];			
			// 		bkb = text.split("[过滤板块]")[1];	  

			// 		var text1 = load("自选股.txt");  
			// 		zxg =text1;	  

			// 		var text2 = load("上影线套利.txt");  
			// 		syx =text2;	
			// 		getSource();																			
			// 	},10000);
			// })
			
			function load(name) {
				var xhr = new XMLHttpRequest()							
				okStatus = document.location.protocol === "file:" ? 0 : 200;				
				xhr.open('GET', name, false);
				xhr.overrideMimeType("text/html;charset=gb2312");//默认为utf-8				
				xhr.send(null);
				return xhr.status === okStatus ? xhr.responseText : null;
			}

			function readTxt(files) {
					var reader = new FileReader();
					var file = files[0]; //files为上传组件获取的地址
					reader.readAsText(file, 'utf-8');
					reader.onload = function(){
						reader.result.split('\n').forEach(function(v, i){
							console.log(v);
						});
					};
					reader.onerror = function(){
						console.log('读取失败');
						console.log(reader.error);
					};
				}
							
			var z = "1";
			$(function() {
				setInterval(function() {
					if(z == "1")
					{			
						try {
								var text = load("个股详情自定义板块.txt"); 
								bka = text.split("[高亮板块]")[1].split("[过滤板块]")[0];			
								bkb = text.split("[过滤板块]")[1];	  
							} catch (error) {
								
							}

						try {
							var text1 = load("自选股.txt");  
							zxg =text1;	 
						} catch (error) {
							
						}

						try {
							var text2 = load("上影线套利.txt");  
							syx =text2;	
						} catch (error) {
							
						} 
	
						getSource();										
					}					
				},
				500);
			})
			
			function time_range(beginTime, endTime) {
				var strb = beginTime.split(":");
				if (strb.length != 2) {
					return false;
				}

				var stre = endTime.split(":");
				if (stre.length != 2) {
					return false;
				}

				var b = new Date();
				var e = new Date();
				var n = new Date();

				b.setHours(strb[0]);
				b.setMinutes(strb[1]);
				e.setHours(stre[0]);
				e.setMinutes(stre[1]);

				if (n.getTime() - b.getTime() > 0 && n.getTime() - e.getTime() < 0) {
					hqsx();					
					console.log(true)
					return true;				
				} else {
					console.log(false)
				    return false;     
				}
			}
			
			//同股状态下刷新
			$(function() {
				setInterval(function() {
					if(z == "1" && k == 0 && q == 0)
					{	
						time_range("9:00","15:15")					
						hqsx();										
					}					
				},
				60000);
			})
			
			var ds = 0;
			function hqsx() {
				ds = 1;
			}
			
			function changeStyle() { 	
				var obj = document.getElementById("towriter");	 
				obj.style.left= "0px"; 				
				obj.style.width= "547px";	
				obj.style.height= "540px";		
								
				var obj1 = document.getElementById("towrite1");	//上部				
				obj1.style.fontSize="13px";	
				obj1.style.minHeight= "10px";  //最小高度，自动高度						
				
				var obj2 = document.getElementById("towrite2"); //左下
				obj2.style.left= "0px"; 				
				obj2.style.width= "215px";	
				obj2.style.height= "450px";	
				obj2.style.fontSize="12px";	
				obj2.style.marginTop= "0px";
				obj2.style.overflowX="hidden"; 

				
				var obj3 = document.getElementById("towrite3"); //右下
				obj3.style.left= "0px"; 
				obj3.style.width= "245px";
				obj3.style.height= "450px";
				obj3.style.fontSize ="12px";
				obj3.style.marginTop= "0px";
				obj3.style.marginLeft = "1px";  	
			}			
			
			
			function changeCss(obj,id){				
				var alist = document.getElementById(id).getElementsByTagName("a");					
				for(var i = 0; i < alist.length; i++){			

					<!-- if(alist[i] == undefined){ -->
						<!-- break; -->
					<!-- } -->

					if(alist[i].id.includes("jp")){
						continue;
					} 

					alist[i].style.color = "#E5E5E5"; //给所有a标签赋原色

					if(alist[i].id == "hl"){
						alist[i].style.color = zdycolor; //自定义板块高亮
					}

					if(alist[i].id == "chuangyeban"){
						alist[i].style.color = cybcolor; //自定义板块高亮
					}

					if(alist[i].id == "kechuangban"){
						alist[i].style.color = kcbcolor; //自定义板块高亮
					}

					if(alist[i].id == "zixuangu"){
						alist[i].style.color = zxgcolor; //自定义板块高亮
					}

					if(alist[i].id == "shangyingxian"){
						alist[i].style.color = syxtlcolor; //自定义板块高亮
					}  
				}
				ranking();	
				obj.style.color = "#00FFFF"; //令当前标签高亮 
			}
			
			
			//js日期比较( 要求日期格式：yyyy-mm-dd)
			 function DateBiJiao(firstDate, lastDate) {
				var arr = firstDate.split("-");
				var firsttime = new Date(arr[0], arr[1], arr[2]);
				var firsttimes = firsttime.getTime();

				var arrs = lastDate.split("-");
				var  lasttime = new Date(arrs[0], arrs[1], arrs[2]);
				var  lasttimes =  lasttime.getTime();

				if (firsttimes> lasttimes) {
					return false;
				}
				else
					return true;
			}
			
			var k = 0;
			var gpdm = "";
			var gpmc = "";				
			function getSource() {	    
				var u = decodeURI(window.location.href);								
				if(u.indexOf("##") > -1){
					var gp = u.split('##');				
					dm = gp[1];
					gpmc = gp[2];					
					//alert(dm);
					if(dm == gpdm){
						k = 0;
					}else{
						k = 1;
						temp1 = "";	
						temp2 = "";
					}				
				}else{
					dm = "000833";
					gpmc = "粤桂股份";
					k = 1;
					temp1 = "";	
					temp2 = "";
				}
				
				if(dm != gpdm){	
					gpdm = dm;					
					if(k == 1 || ds == 1)	
					{
						ds = 0;	
						var url11 = "https://apphq.longhuvip.com/w1/api/index.php?a=GetKLineZhangTing&apiv=w26&c=StockLineData&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm; 														
						var url12 = "https://apphis.longhuvip.com/w1/api/index.php?a=GetDayZhangTing&st=1&apiv=w26&c=HisLimitResumption&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm;
						
						var url21 = "https://apphq.longhuvip.com/w1/api/index.php?a=GetFeaturedSection&c=StockL2Data&apiv=w26&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm + "&";
						var url22 = "https://apparticle.longhuvip.com/w1/api/index.php?a=GetConceptJXBKw23&apiv=w24&c=StockF10Basic&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm;
						var url23 = "https://apparticle.longhuvip.com/w1/api/index.php?a=GetConceptw23&c=StockF10Basic&apiv=w29&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + gpdm;
						var sc = "";
						if(gpdm.substr(0 , 1) == "6"){
							//sc = ".SH";
							sc = "17";
						}
						else{
							//sc = ".SZ";
							sc = "33";
						}
						//var url3 = "https://datacenter.eastmoney.com/securities/api/data/get?source=SECURITIES&p=1&type=RTP_F10_SUMMARYDETAIL&params=" + gpdm + sc;					
						var url3 = "https://eq.10jqka.com.cn/stockCourier/api/courier/eventData/" + sc + "/" + gpdm + ".txt";					
						
						if (window.XMLHttpRequest) {					
						xmlHttp11 = new XMLHttpRequest();
						} else {					
							xmlHttp11 = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlHttp11.onreadystatechange = writeSource1;
						xmlHttp11.open("GET", url11, true);
						xmlHttp11.send(null);
						
						if (window.XMLHttpRequest) {					
						xmlHttp12 = new XMLHttpRequest();
						} else {					
							xmlHttp12 = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlHttp12.onreadystatechange = writeSource1;
						xmlHttp12.open("GET", url12, true);
						xmlHttp12.send(null);
						
						if (window.XMLHttpRequest) {					
						xmlHttp13 = new XMLHttpRequest();
						} else {					
							xmlHttp13 = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlHttp13.onreadystatechange = writeSource1;
						xmlHttp13.open("GET", url3, true);
						xmlHttp13.send(null);
						
						if (window.XMLHttpRequest) {
						xmlHttp21 = new XMLHttpRequest();
						} else {					
							xmlHttp21 = new ActiveXObject("Microsoft.XMLHTTP");
						}
						xmlHttp21.onreadystatechange = writeSource2;
						xmlHttp21.open("GET", url21, true);
						xmlHttp21.send(null);
						
						if (window.XMLHttpRequest) {
						xmlHttp22 = new XMLHttpRequest();
						} else {					
							xmlHttp22 = new ActiveXObject("Microsoft.XMLHTTP");
						}

						xmlHttp22.onreadystatechange = writeSource2;
						xmlHttp22.open("GET", url22, true);
						xmlHttp22.send(null);
						
						if (window.XMLHttpRequest) {
							xmlHttp23 = new XMLHttpRequest();
						} else {					
							xmlHttp23 = new ActiveXObject("Microsoft.XMLHTTP");
						}

						xmlHttp23.onreadystatechange = writeSource2;
						xmlHttp23.open("GET", url23, true);
						xmlHttp23.send(null);

					}
				}
			}
			
			var yy = "";			
			function writeSource1() { 
				if (xmlHttp11.readyState == 4 && xmlHttp12.readyState == 4 && xmlHttp13.readyState == 4) { 										
					var data1 = xmlHttp11.responseText	
					var data2 = xmlHttp12.responseText						
					var data = data1;
					if(data2.indexOf('"List":[]') == -1){   //his不为空
						//if(data1.indexOf('"List":[]') > -1 || data1.indexOf('"Reason":false') > -1){  //hq为空 或 "Reason":false
						if(data1.indexOf('"List":[]') > -1){  //hq为空
							data = data2;
						}
					}					
					
					var title = "涨停原因：";
					if(data1.indexOf('"Type":"1"') > -1){
						title = "大涨原因：";
					}
					
					
					//alert(data);
					//document.write(data);
					var transform_aa = [           
						{"tag":"ul", children:function(){return(json2html.transform(this.List, transform_bb));}}
					];
					
					var ztyy = "";
					yy = "";
					var transform_bb=								
					{"tag":"p", children:function(){
						var jx = "<td><a style='position:absolute; right:120px;' href='javascript:void(0)' onclick='updates()'>" + "详情" + "</a></td>";					
						yy = this.Reason;					
						if(yy != false){
							yy = yy.split('；')[0]
						}else{
							yy = "";
						}
						ztyy = 	this.GNSM;						
						if(this.Date == dt){
							return("<b style='color:#fff'>" + this.Date + "：" + yy + "&nbsp;&nbsp;&nbsp;&nbsp;" + this.SCLT + jx + "</b>");
						}else{
							return("<b>" + this.Date + "：" + yy + "&nbsp;&nbsp;&nbsp;&nbsp;" + this.SCLT + jx + "</b>");
						}										
					}};
										
					var html = json2html.transform(data, transform_aa);					
					div = document.getElementById('towrite1');
					var sx = "<a style='position:absolute; right:90px;'  href='javascript:void(0)' id='sx' onclick='updatex()'>停止刷新</a>";	
					div.innerHTML = '<h4>个股详情：' + gpdm + "&nbsp;&nbsp;&nbsp;" + gpmc + sx + '</h4><ul><b>' + title + '</b></ul>' + html;
					
					//添加分类Div
					var newDiv1 = document.createElement("div");
					newDiv1.id = "xq";
					newDiv1.style.display = "none";
					document.getElementById("towrite1").appendChild(newDiv1);
					div1 = document.getElementById("xq");
					div1.innerHTML += "<p>" + ztyy + "</p>" ;	
					temp1 = "";	
					
					//同花顺速递
					var data3 = xmlHttp13.responseText
					data3 = data3.replace(/\s+/g,"；");
					data3 = data3.match(/"events":(\S*)}]/)[1] + "}]";
					
					var result = JSON.parse(data3); //JSON字符串转换为对象
					function up(a,b){
						var aa = a.ctime;
						var bb = b.ctime;					
						if(a.catename == "涨停分析"){
							aa = 0;
						}
						if(b.catename == "涨停分析"){
							bb = 0;
						}					
						return aa - bb					
					}
					result.sort(up);
					result = JSON.stringify( result );						
					data3= '{\"data\":' + result + "}";
					//document.write(data3);	
					
					xqs = data3.split('},{');
					var dq = "<td><a style='position:absolute; right:120px;' href='javascript:void(0)' onclick='updatest()'>" + "详情" + "</a></td>";
					div.innerHTML += "<ul><b>同花顺速递：（" + xqs.length + "项）" + dq + "</b></ul>";
					//添加分类Div
					var newDiv3 = document.createElement("div");
					newDiv3.id = "txq";
					newDiv3.style.display = "none";						
					document.getElementById("towrite1").appendChild(newDiv3);
					div3 = document.getElementById("txq");
					
					var transform_aa1 = [           
					{"tag":"p", children:function(){return(json2html.transform(this.data, transform_bb1));}}
					];
					
					<!-- var transform_bb1 = [            -->
					<!-- {"tag":"p", children:function(){return(json2html.transform(this.events, transform_cc1));}} -->
					<!-- ]; -->
					
					var transform_bb1=												
					{"tag":"ul style=color:#FFA500;", children:[									
					//{"tag": "li style=color:#00FFFF;", "html":"${catename}： ${date}"},
					{"tag": "li style=color:#00FFFF;", "html":function(){
						if(this.catename == "龙虎榜"){							
							var url = "http://www.treeid/dlghttp://page.tdx.com.cn:7615/site/kggx/tk_ygzl_lhb.html?info=xxxxxx&amp;pageId=dpyd&amp;color=0&amp;bkcolor=000000"
							var lhb = "<a href='" + url + "' style='color:#FF00FF;'>" + this.catename + "：" + this.date + "</a>";							
							return(lhb);
						}else{
							return(this.catename + "：" + this.date);
						}
					
					}},
					{"tag": "p", "html": function(){
						if(this.catename == "涨停分析"){
							return(this.title.replace("涨停分析:","").replace("｜","：<br>"));
						}else{
							return(this.content);
						}
					}},
					//{"tag": "p", "html":"${title}"},
					//{"tag": "p", "html":"${content}"},
					{"tag": "p style=color:#FFF5EE;", "html":"${desc}"}, 						
					]};
					
					var html1 = json2html.transform(data3, transform_aa1);	
					div3.innerHTML += html1;
					temp12 = "";
							
					setTimeout(function(){getdcrd()}, 100);  //东财热点 延时执行
			
					if(ztxq == 1 && ztyy != ""){  //显示涨停原因
						updates();
					}
					if(sdxq == 1){    //显示同花顺速递
						updatest();
					}
					if(rdxq == 1){    //显示东财热点
						updaterd();
					}
				}
			}
								
			//东财热点
			function getdcrd() {
				var url =  "https://vipmoney.eastmoney.com/collectapi/ranking/GubaHotTopicNew?code=" + gpdm;
				var div = document.getElementById('towrite1');
				var xhr = new XMLHttpRequest();	
				xhr.open("GET", url, false);//同步 
				xhr.send(null)
				var dcs = xhr.responseText;
				var dcs = dcs.replace(/ /g,"");
				var rxq = "<td><a style='position:absolute; right:120px;' href='javascript:void(0)' onclick='updaterd()'>" + "详情" + "</a></td>";					
				var dcrd = "";
				if(dcs.indexOf("name")>-1){
					dcrd = dcs.match(/"name":"(\S*)","num"/)[1];
					rdid = dcs.match(/"htid":(\S*),"name"/)[1];
					dcrd = "<ul><b>东财热点：<font color=#FFD700>" + dcrd + "</font>" + rxq + "</b></ul>";
									
					div.innerHTML += dcrd;
					//添加分类Div
					var newDiv2 = document.createElement("div");
					newDiv2.id = "dcrd";
					newDiv2.style.display = "none";						
					div.appendChild(newDiv2);
					div2 = document.getElementById("dcrd");
					
					var url1 = "http://gubatopic.eastmoney.com/interface/GetData.aspx"; 											
					xhr1 = new XMLHttpRequest();				
					var array = "param=htid=" + rdid + "&path=newtopic/api/Topic/TopicDetailsRead";						
					xhr1.open("POST", url1, false); 			
					xhr1.setRequestHeader("Content-Type","application/x-www-form-urlencoded;charset=UTF-8");				
					xhr1.send(array);				
					var rds = xhr1.responseText	
					rds = rds.replace(/\s+/g,"").replace(/<br>/g,"").replace(/[\r|\n]/g,"");						
					var rdjd = rds.match(/"lead":"(\S*)","participantCount/)[1];
					div2.innerHTML += "<ul style='color:#FFA500;margin-left:-5px;'>" + rdjd + "</ul>";					
					temp21 = "";
				}
			}
			
			var temp21 = "";					
			function updaterd() {			
				if(document.getElementById("dcrd")){					
					div = document.getElementById("dcrd");
					if(temp21.indexOf("dcrd") == -1){
						temp21 += "dcrd" + ";";
						div.style.display = "block";
						div.style.border="1px solid #999";
						div.style.color = "#FFA500";
					}else{
						temp21 = temp21.replace("dcrd" + ";" , "");
						div.style.display = "none";
					}
				}				
			}
			

			var temp1 = "";					
			function updates() {			
				if(document.getElementById("xq")){					
					div1 = document.getElementById("xq");
					if(temp1.indexOf("xq") == -1){
						temp1 += "xq" + ";";
						div1.style.display = "block";
						div1.style.border="1px solid #999";
						div1.style.color = "#FFA500";
					}else{
						temp1 = temp1.replace("xq" + ";" , "");
						div1.style.display = "none";
					}
				}
				if(temp1 == ""){  //查看详情时不刷新				
					q = 0;
				}else{
					q = 1;
				}				
			}
			
			var temp12 = "";					
			function updatest() {			
				if(document.getElementById("txq")){					
					div12 = document.getElementById("txq");
					if(temp12.indexOf("txq") == -1){
						temp12 += "txq" + ";";
						div12.style.display = "block";
						div12.style.border="1px solid #999";						
					}else{
						temp12 = temp12.replace("txq" + ";" , "");
						div12.style.display = "none";
					}
				}
				if(temp12 == ""){  //查看详情时不刷新				
					q = 0;
				}else{
					q = 1;
				}				
			}
			
			
			var temp2 = "";	
			var q = 0;			
			function updatexq(ss) {	
				if(document.getElementById(ss)){					
					div2 = document.getElementById(ss);
					if(temp2.indexOf(ss) == -1){
						temp2 += ss + ";";
						div2.style.display = "block";
						div2.style.whiteSpace = "normal";
						div2.style.border="1px solid #999";
						div2.style.color = "#FFA500";
					}else{
						temp2 = temp2.replace(ss + ";" , "");
						div2.style.display = "none";
					}
				}
				if(temp2 == ""){  //查看详情时不刷新				
					q = 0;
				}else{
					q = 1;
				}
			}
			
			
			
			function updatex() {				
				aObj = document.getElementById('sx');
				if(aObj.innerText.trim() == "停止刷新"){
					z = "0";
					aObj.innerText= "自动刷新";
					aObj.style.color = "#ADFF2F";
				}else if(aObj.innerText.trim() == "自动刷新"){
					z = "1";
					aObj.innerText = "停止刷新";
					aObj.style.color = "#E5E5E5";					
				}
			}
						
			function updated() {
				z = "0";			
				aObj = document.getElementById('sx');
				if(aObj.innerText.trim() == "停止刷新"){					
					aObj.innerText = "自动刷新";
					aObj.style.color = "#ADFF2F";
				}					
			}
			
			function UnUnicode(str) {
				return unescape(str.replace(/\\/g, "%"));
			}
			
			function writeSource2() { 
				if (xmlHttp21.readyState == 4 && xmlHttp22.readyState == 4 && xmlHttp23.readyState == 4) { 
					div1 = document.getElementById('towrite2');
					div1.innerHTML = "<h4 style='color:#FFFF00'>精选板块</h4>";				
					var data = xmlHttp21.responseText					
					data = data.replace(/ /g,"");				
					data = data.replace(/(\[\").*?(?=\])/g,function(word){ 
					str = word.match(/\[(\S*)/)[1];
					//str = word;
					return '{"code":' + str.split(',')[0] + 
					',"name":' + str.split(',')[1] +
					',"zf":' + str.split(',')[2] ;});					
					data = data.replace(/\[\[/g,'[{').replace(/\]\]/g,"}]").replace(/],{/g,"},{");
					data = data.match(/(\S*)],"ttag/)[1];	
					//document.write(data);	
					
					var data1 = xmlHttp22.responseText
					data1 = data1.replace(/ /g,"");
					data1 = UnUnicode(data1);
					data1 = data1.replace(/\s+/g,"");
					data1 = data1.match(/(\S*)],\"errcode/)[1];									
					//document.write(data1);
					var bks = "";
					var gn = data1.split('},{');
					//var m = 1;
					for (i = 0; i < gn.length; i++){
						var code = gn[i].match(/\"CCode\":\"(\S*)\",\"Analysis/)[1];
						if(data.indexOf(code) == -1){
							var name = gn[i].match(/\"CName\":\"(\S*)\"/)[1];
							data += ',{"code":"' + code + '","name":"' + name + '","zf":null}';							
						 }									
					}
					data = data + "]";
					//document.write(data);
					var j1 = 0;
					let codeArray = [];
					var ss = data.split('},{');	
					// 所属题材			
					for (i = 0; i < ss.length; i++){
						var code = ss[i].match(/\"code\":\"(\S*)\",\"name/)[1];						
						var name = ss[i].match(/\"name\":\"(\S*)\",\"zf/)[1];
						//codeArray.push(code);
						codeArray.push(code.trim()+"."+name);
						name = UnUnicode(name).replace('概念','').replace('.','');						
						if(bkb.indexOf(name) == -1){  //自定义板块过滤
							var zf = "";
							if(i != ss.length - 1){ 						
								zf = ss[i].match(/\"zf\":(\S*)/)[1];
							}else{
								zf = ss[i].match(/\"zf\":(\S*)\}\]/)[1];							
							}						
							var zfs = "";
							if(zf != 'null'){
								zfs = "&nbsp;&nbsp;" + zf + "%";   //涨幅
							}
							var ys = "";
							if(bka.indexOf(name) > -1){
								ys = " style='color:" + zdycolor + "' id = 'hl'";  //自定义板块高亮
							}else{
								ys = " id='" + name;
							}
							//点击呈现板块成分
							bks = "<a href='javascript:void(0)'" + ys + "' onclick='changeCss(this,\"towrite2\");update(" + "\"" +
										code + "\"+\"#\"+" + "\"" + name + "\"" + ")'>" + ( j1 + 1) + "." +
										 "&nbsp;" + cutStr(name.replace('%',''),10) + "</a>"	;	 
							
							
							var zfx = "<td><a id='jpzt"+code+"' style='position:absolute; right:-13px;' href='javascript:void(0)' onclick='updatexq(888" + code + ")'>" + zfs + "</a></td>";	

							var jx = "<td><a style='position:absolute; right:-13px;' href='javascript:void(0)' onclick='updatexq(888" + code + ")'>" + "详情" + "</a></td>";						
							bks = bks + zfx ;//+jx;							
							var xq = "";
							if(data1.indexOf(code) > 0){	
								//alert(code);		
								var s = data1.split(code)[1];
								//alert(s);								
								var k1 = s.indexOf("\"Analysis\":\"");
								var k2 = s.indexOf("}");
								xq = s.substring(k1,k2);												
								xq = xq.match(/\"Analysis\":\"(\S*)\",\"CName/)[1];							
								if(xq == ""){
									xq = "暂无";
								}							
							}else{
								xq = "暂无";
							}	
							
							var bkdm = code;		
							subclass(bkdm , bks , xq);							
							if (j1 == 0 && y == 1){
								temp = code + ";";
								update(code + "#" + name);
							}
							j1++;
						}						
					} 


					//常规板块
					div1.innerHTML += "<br><h4 style='color:#FFFF00'>常规板块</h4>";
					var data2 = xmlHttp23.responseText
					//alert(data2)
					data2 = data2.replace(/ /g,"");
					data2 = UnUnicode(data2);
					data2 = data2.replace(/\s+/g,"");
					data2 = data2.match(/(\S*)],\"errcode/)[1];	
					data2 = data2 + "]}";
					//document.write(data2);
					var j2 = 0;
					ss2 = data2.split('},{');				
					for (i = 0; i < ss2.length; i++){
						var code = ss2[i].match(/\"CCode\":\"(\S*)\",\"CName/)[1];
						var name = ss2[i].match(/\"CName\":\"(\S*)\",\"Analysis/)[1];
						//name = UnUnicode(name);
		                    if(bkb.indexOf(name) == -1){    //自定义板块过滤
							var xq = ss2[i].match(/\"Analysis\":\"(\S*)\"/)[1];	
							var ys = "";
							if(i == 0 || bka.indexOf(name) > -1){
								ys = " style='color:" + zdycolor + "' id = 'hl'";  //自定义板块高亮
							}else{
								ys = " id='" + name;
							}
							var bks = "<a href='javascript:void(0)'" + ys + "' onclick='changeCss(this,\"towrite2\");update(" + "\"" +
										code + "\"+\"#\"+" + "\"" + name + "\"" + ")'>" + ( j2 + 1) + "." +
										 "&nbsp;" + name + "</a>"	;		
							var jx = "<td><a style='position:absolute; right:-13px;' href='javascript:void(0)' onclick='updatexq(" + ( j2 + 1) + "888" + code + ")'>" + "<<" + "</a></td>";						
							//bks = bks + jx;
							div1.innerHTML += "<p>" + bks + jx + "</p>";
							
							//添加详情
							var newDiv = document.createElement("div");
							newDiv.id = ( j2 + 1) + "888" + code;
							newDiv.style.display = "none";
							newDiv.style.whiteSpace = "normal";
							div1.appendChild(newDiv);
							
							div2 = document.getElementById(j2 + 1 + "888" + code);
							div2.innerHTML = xq;
							j2++;
						}						
					}
					
					//变色
					var interval = setInterval(function() {
											if(yy != ""){	
												ranking();							
												clearInterval(interval);							
											}					
										},100);		
						

					//统计涨停数量
						setTimeout(loop, 100);
						var m = 0;
						function loop(){
							var code = codeArray[m];	
							m++;
							bkgg(code); 

							if( m < codeArray.length){
								setTimeout(loop, 1);
							}	 

						};
						
				}				
			}
			
			function bkgg(codeName){
				var ss = codeName.split(".");
				var code =ss[0];
				var name =ss[1];
				var url2 = "https://apphq.longhuvip.com/w1/api/index.php?st=50&Index=0&IsKZZType=0&old=1&Order=1&a=ZhiShuStockList_W8&apiv=w35&Type=6&c=ZhiShuRanking&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-394d-fc3a-0a05-000004938839&PlateID=" + code + "&"; 		

				//alert('jp'+code);

				var num=0;
				var lbzgNum=0;
				var lbzgName='';	
				var lbzgCode='';
				var zgNum=0;	 
				var zgName='';	
				var zgBNum='';
				var zgCode=''; 

				$.ajax({
					type: "get",
					url: url2,
					dataType: "json",
					async : false,
					cache:false,
					timeout:3000,
					success: function(data) { 
						for (i = 0; i < data.list.length; i++){
							var aa = data.list[i];  
							var dmcode = aa[0].trim();

								if(aa[28]>0){
									num ++;  //涨停数
								}  		
								
								
							// 获取原始字符串
							var originalString = aa[23].trim();
							// 使用正则表达式匹配开头的数字
							var regex = /^\d+/; 

							// 提取的数字，如果存在的话 ， N 连扳
							var lianban = /^[0-9]{1,}连板$/.test(originalString.toString());
							if(lianban){
								var match = originalString.match(regex);
								var extractedNumber = match ? match[0] : '';
								var nn = parseInt(extractedNumber);
								if(nn> 0){
								if(lbzgNum<nn){
									lbzgNum=extractedNumber;
									lbzgName=aa[1].trim();
									lbzgCode=dmcode;
									}
								}
							}

							// 提取的数字，如果存在的话 ，N 天N 扳
							var match = originalString.match(regex);
							var extractedNumber = match ? match[0] : '';
							var nn = parseInt(extractedNumber);
							if(nn> 0){
							if(zgNum<nn){
								zgNum=extractedNumber;
								zgName=aa[1].trim();
								zgCode=dmcode;
								zgBNum=originalString.replace('天',',').replace('板','')
								} 
							}
						}	 						
					}
				});	 

				//板块最强个股

				if(num==0) return;

				var faselements = document.getElementById('jp'+code);  
				if(faselements!=null){   
					var elements = faselements.querySelector('#jpzt'+code);  

					if(elements==null) return; 
					

					elements.innerHTML = "["+num+"]"; 
					elements.style.right = ztwz;
					if(num>10){
						elements.style.color = 'red';  
					} 
					
					if(zgCode==lbzgCode){
						var blink = document.createElement('a');
						blink.id = "jpzt"+zgCode;
						blink.style.position = 'absolute';
						blink.style.right = bkhex1;
						var zgb = zgName + "["+zgNum +"]"; 
						if('[0]'!=zgb){
							blink.textContent = zgb; 
							blink.href = "http://www.treeid/code_"+zgCode; 
							if(zgNum>6){
								blink.style.color = "#FF0000";
							} 
						}else{
							blink.innerHTML = "";
						} 
						faselements.appendChild(blink);
					}else{
						var zgb1 = lbzgName.replace('*','').substring(0, 2) + "["+lbzgNum +"] "
						var zgb2 = " "+zgName.replace('*','').substring(0, 2) + "["+zgBNum +"]";
						if('[0]'!=zgb1.trim() && '[0]'!=zgb2.trim()){
							var blink = document.createElement('a');
							blink.id = "jpzt"+lbzgCode;
							blink.style.position = 'absolute';
							blink.style.right = bkhex1;
							blink.textContent = zgb1; 
							blink.href = "http://www.treeid/code_"+lbzgCode;
							if(lbzgNum>6){
								blink.style.color = "#FF0000";
							} 

							faselements.appendChild(blink);

							var clink = document.createElement('a');
							clink.id = "jpzt"+zgCode;
							clink.style.position = 'absolute';
							clink.style.right = bkhex2;
							clink.textContent = zgb2; 
							clink.href = "http://www.treeid/code_"+zgCode;
							if(zgNum>6){
								clink.style.color = "#FF0000";
							} 

							faselements.appendChild(clink);

						}else{
							if('[0]'!=zgb1.trim() && '[0]'==zgb2.trim()){
								var blink = document.createElement('a');
								blink.id = "jpzt"+lbzgCode;
								blink.style.position = 'absolute';
								blink.style.right = bkhex1;
								blink.textContent = zgb1; 
								blink.href = "http://www.treeid/code_"+lbzgCode;
								if(lbzgNum>6){
									blink.style.color = "#FF0000";
								} 

								faselements.appendChild(blink);

							}
							if('[0]'!=zgb2.trim() && '[0]'==zgb1.trim()){
								var blink = document.createElement('a');
								blink.id = "jpzt"+zgCode;
								blink.style.position = 'absolute';
								blink.style.right = bkhex1;
								blink.textContent = zgb2; 
								blink.href = "http://www.treeid/code_"+zgCode;
								if(zgNum>6){
									blink.style.color = "#FF0000";
								} 

								faselements.appendChild(blink);
							}
						}




					}

				}

			}

			//子类
			function subclass(bkdm , bks, xq) {
			//alert(bks);
				var url3 = "https://apphq.longhuvip.com/w1/api/index.php?a=SonPlate_Info&apiv=w35&c=ZhiShuRanking&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-394d-fc3a-0a05-000004938839&PlateID=" + bkdm + "&"; 
 
				var xhr = new XMLHttpRequest();	
				xhr.open("GET", url3, false);//同步 
				xhr.send(null)																		
				div1 = document.getElementById('towrite2');
				//div1.innerHTML = div1.innerHTML + "<ul><li>" + bks + "</li></ul>";
				var data3 = xhr.responseText;						
				if(data3.indexOf('\"List\":[]') == -1) {
					var dms = bks.split('.');					
					div1.innerHTML += "<p id=jp"+bkdm+">" + dms[0] + ".★" + dms[1] + "</p>"; 
					
					//添加详情
					var newDiv1 = document.createElement("div");
					newDiv1.id = "888" + bkdm;
					newDiv1.style.display = "none";					
					document.getElementById("towrite2").appendChild(newDiv1);
					
					div2 = document.getElementById("888" + bkdm);
					div2.innerHTML += xq;
						
					//添加分类Div
					var newDiv = document.createElement("div");
					newDiv.id = bkdm;
					newDiv.style.display = "none";
					document.getElementById("towrite2").appendChild(newDiv);
						
					//data3 = data3.replace(/ /g,"").match(/(\S*)\]\],\"/)[1] + ']]';	
					data3 = data3.replace(/ /g,"").match(/\{\"List\":(\S*)\]\],\"/)[1] + ']]';	
					data3 = data3.replace(/(\[\").*?(?=\])/g,function(word){ str = word.match(/\[(\S*)/)[1]; return '{"code":' + str.split(',')[0] + ',"name":' + str.split(',')[1]+',"qd":'+str.split(',')[2];});							
					data3 = data3.replace(/\],\{/g,"},{").replace(/\]\]/g,"}]");
					//alert(data3);	
					//document.write(data3);

					var result = JSON.parse(data3); //JSON字符串转换为对象
					function up(a,b){
					return b.qd-a.qd
					}
					result.sort(up);
					result = JSON.stringify( result );						
					data3= '{\"List\":' + result + "}";
					//document.write(data3);

					var transform_ee1 = [           
					{"tag":"ul", children:function(){return(json2html.transform(this.List, transform_ff1));}}
					];

					var transform_ff1= 
					{"tag":"p", children:[
					{"tag":"p", children:[
					{"tag": "li", "html":"<a href='javascript:void(0)' id='" + bkdm + "' onclick='changeCss(this,this.id);update(\"${code}\"+\"#\"+\"${name}\")'>${name}&nbsp;强度：${qd}</a>"}
					]}]};

					var html3 = json2html.transform(data3, transform_ee1);		
					//div1 = document.getElementById('towrite1');
					var div = document.getElementById(bkdm);
					div.innerHTML += html3;				
				}
				else
				{ 
					div1.innerHTML = div1.innerHTML +  "<p id=jp"+bkdm+">" + bks + "</p>";
					//添加详情
					var newDiv1 = document.createElement("div");
					newDiv1.id = "888" + bkdm;
					newDiv1.style.display = "none";
					newDiv1.style.whiteSpace = "normal";
					document.getElementById("towrite2").appendChild(newDiv1);
					
					div2 = document.getElementById("888" + bkdm);
					div2.innerHTML += xq;
				}							
			}
			
			var temp = "";
			var bdm = "";
			var bkm = "";
			var y = 1;			
			function update(ss) {
				//alert(ss);
				y = 1;
				if(ss != "0"){
					var dms = ss.split('#');					
					bdm = dms[0];
					bkm = dms[1];
					//alert(temp);
					if(document.getElementById(bdm)){					
						div1 = document.getElementById(bdm);
						if(temp.indexOf(bdm) == -1){
							temp += bdm + ";";
							div1.style.display = "block";
							div1.style.border = "1px solid #646464";																				
						}else{
							temp = temp.replace(bdm + ";" , "");
							div1.style.display = "none";
						}
					}
					//alert(temp);
				}
				//alert(bdm);
				var bfyy = "<a style='padding-left:0px' href='javascript:void(0)' onclick='updateb()'>【原因】</a>";
				var zz = "<a style='position:absolute; right:35px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";				
				div2 = document.getElementById('towrite3');	
				//div2.innerHTML = '<h4>' + bkm + zz + '</h4>';				
				div2.innerHTML = '<h4>' + bkm + bfyy + zz + '</h4>';	

				var url2 = "https://apphq.longhuvip.com/w1/api/index.php?st=50&Index=0&IsKZZType=0&old=1&Order=1&a=ZhiShuStockList_W8&apiv=w35&Type=6&c=ZhiShuRanking&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-394d-fc3a-0a05-000004938839&PlateID=" + bdm + "&"; 		


				if (window.XMLHttpRequest) {
					xmlHttp3 = new XMLHttpRequest();
					} else {					
						xmlHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
					}					
				xmlHttp3.onreadystatechange = writeSource3;				
				xmlHttp3.open("GET", url2, true);
				xmlHttp3.send(null);		

			}

			// 四舍五入到指定的小数位数
			function roundToDecimalPlace(number, decimalPlaces) {
				const factor = Math.pow(10, decimalPlaces);
				return Math.round(number * factor) / factor;
			}

			function unicodeToChinese(str) {
				return str.replace(/\\u[\dA-F]{4}/gi, function (match) {
					return String.fromCharCode(parseInt(match.replace(/\\u/g, ''), 16));
				});
			} 

			//计算涨停数量
			function writeSource44() {
				if (xmlHttp33.readyState == 4) {   
					var data2 = xmlHttp33.responseText;
					var code = xmlHttp33.responseURL.split('&PlateID=')[1].replace('&','');
					//var dd = unicodeToChinese(data2);
					data2 = data2.replace(/ /g,"").match(/{"list":(\S*)/)[1].split("]]")[0] + ']]';
					data2 = data2.replace(/(\[\").*?(?=\])/g,function(word){ 
						str = word.match(/\[(\S*)/)[1]; 
						var vv = str.split(',');
						//alert(unicodeToChinese(vv[1])+':'+vv[28]);
						return  vv[28];});

					data2 = data2.replace('\[','').replace(new RegExp('\]', 'g'),'');
					var fds= data2.split(',');
					//alert(id);
					num=0;
					for (i = 0; i < fds.length; i++){
						var aa = fds[i]; 

						if(!aa.includes("--")){
							num ++;  //涨停数
						} 
					} 

					var elements = document.getElementsByName('jp'+code);
					//if(elements.length=0) return;
					var hh = elements[0].innerHTML;
					elements[0].innerHTML= hh.replace('%',"%("+num+") ");


					//alert(data2);


				}    
			}
			
			function writeSource3() { 			
				if (xmlHttp3.readyState == 4) {                  	
				var data2 = xmlHttp3.responseText;
				//document.write(data2);
				//data2 = data2.replace(/ /g,"").match(/(\S*)\]\],\"/)[1] + ']]';	
				data2 = data2.replace(/ /g,"").match(/{"list":(\S*)/)[1].split("]]")[0] + ']]';	
				//data2 = data2.replace(/(\[\").*?(?=\])/g,function(word){ str = word.match(/\[(\S*)/)[1]; return '{"code":' + str.split(',')[0] + ',"name":' + str.split(',')[1]+',"zf":'+str.split(',')[6];});
				data2 = data2.replace(/(\[\").*?(?=\])/g,function(word){ 
				str = word.match(/\[(\S*)/)[1]; 
				var vv = str.split(',');
				return '{"code":' + vv[0] + 
				',"name":' + vv[1] +
				',"zf":'+vv[6] +
				',"lz":'+vv[24] +
				',"zl":'+vv[2] +
				',"lb":'+vv[23] + 
				',"zt":'+vv[39] +
				',"sjsz":'+vv[10]+
				',"fd":'+vv[28];});
								
				data2 = '{\"list\":' + data2.replace(/\],\{/g,"},{").replace(/\]\]/g,"}]") + "}";
				
				var transform_aa2 = [           
				{"tag":"p", children:function(){return(json2html.transform(this.list, transform_bb2));}}
				];
				
				var transform_bb2= 
				{"tag":"p", children:[
				{"tag":"p", children:[															
				//{"tag": "p", "html":"<a href='http://www.treeid/code_${code}'  onclick='changeCss(this,\"towrite3\");updated()'>${name}&nbsp;&nbsp;[${zt}]&nbsp;涨幅：${zf}%&nbsp;${lz}&nbsp;${zl}&nbsp;<font color=#FFA500>${lb}</font></a>"}, 
				{"tag": "p", "html": function(){
					var lz = this.lz;
					var lb = this.lb;
					var sjsz= roundToDecimalPlace(this.sjsz/100000000,2);
					var zr = '';
					var fd = roundToDecimalPlace(this.fd/100000000,2);  //封单
					var zf = this.zf+"%";

					if(fd>0){
						zf = fd + "亿";
						if(fd/sjsz>0.05){
							zf = "<font color=#fd0303;><strong>" + fd + "亿" + "</strong></font>";
						}
					} 


					var lianban = /[6-9]{1}连板$/.test(lb.toString())||/[6-9]{1}板$/.test(lb.toString()) || /[0-9]{2}连板$/.test(lb.toString())||/[0-9]{2}板$/.test(lb.toString());
					var weizhangting = this.fd>0; 

					if(lb.includes("昨")){ 
						//lz = "<font style='border:2px solid #ADFF2F;'>" + lz + "</font>";
						zr = lb.replace("连板",'').replace("昨日",'昨').replace("首",'1').replace("板",'');
						zr="<font style='position:absolute; right:"+zuoribanbq+";'><font color=#FFFF66;>" + zr + "</font></font>";
					}else{
						zr = lb.replace("连",'').replace("首",'1').replace("天",',');
						if(lianban){
							zr="<font style='position:absolute; right:"+lianbanbq+";'><font color=#fa2222;>" + zr + "</font></font>";
						}else{
							zr="<font style='position:absolute; right:"+lianbanbq+";'>" + zr + "</font>";
						}
					}
				
					
					if( lz == "破板"){
						//lz = "<font style='border:2px solid #ADFF2F;'>" + lz + "</font>";
						lz = "<font style='position:absolute; right:"+pozibq+";'><font color=#ADFF2F;><strong>" + lz.replace('板','') + "</strong></font></font>";
					}else{
						if(lianban){
							if(this.zt.length > 0){
								var zt = this.zt.replace('概念','').replace('工业','').replace('AI','');

								lz = "<font style='position:absolute; right:"+xifenbq+";' >[<font color=#B0C4DE;>" + cutStr(zt,4)  + "</font>]</font>"
								//+"<font style='position:absolute; right:95px;'><font color=#fa2222;><strong>龙" + ChineseToNumber(lz.replace('龙',''))  + "</strong></font></font>";
							}
							else{
								if(weizhangting){
									lz = "<font style='position:absolute; right:"+longtoubq+";'><font color=#fa2222;><strong>" + ChineseToNumber(lz.replace('龙','')) + "</strong></font></font>";
								}else{
									lz = "<font style='position:absolute; right:"+longtoubq+";'><font color=#ADFF2F;><strong>" + ChineseToNumber(lz.replace('龙','')) + "</strong></font></font>";
								}
								
							}
						}else{
							if(this.zt.length > 0){ 
								var zt = this.zt.replace('概念','').replace('工业','').replace('AI','');

								lz = "<font style='position:absolute; right:"+xifenbq+";' >[<font color=#B0C4DE;>" + cutStr(zt,4)  + "</font>]</font>" 
							}
							else{

								if(weizhangting){
									lz = "<font style='position:absolute; right:"+longtoubq+";'>" + ChineseToNumber(lz.replace('龙','')) + "</font>";
								}else{
									lz = "<font style='position:absolute; right:"+longtoubq+";'><font color=#ADFF2F;>" + ChineseToNumber(lz.replace('龙','')) + "</font></font>";
								}
								
							}  
						} 
						
					} 

					var _id = "' id=\"zhuban\"";

					if(this.code.substring(0, 2)=="30"){
						_id = "' id=\"chuangyeban\"";
					}

					if(this.code.substring(0, 2)=="68"){
						_id = "' id=\"kechuangban\"";
					} 

					if(zxg.indexOf(this.code) > -1){
						_id = "' id=\"zixuangu\""; 
						}
						
					if(syx.indexOf(this.code) > -1){
					_id = "' id=\"shangyingxian\""; 
					}

						//"<font style='position:absolute; right:95px;'>" + 
					var returnTs1 = "<a href='http://www.treeid/code_" + this.code + _id + 
						"  onclick='changeCss(this,\"towrite3\");updated()'>" +   this.name  
						//+"<font style='position:absolute; right:95px;'>" + lz.replace('二十','廿')  + "</font>"
						+lz
						+"<font style='position:absolute; right:"+zhangf1bq+";'>" + zf  + "</font>" 
						+zr
						+"<font style='position:absolute; right:"+shijiltbq+";'>" + sjsz + "亿" + "</font></a>";
						//+"<font style='position:absolute; right:5px;' color=#FFA500>" + this.lb.replace('昨日','昨').replace('连板','板').replace('天',',') + "</font></a>";
					
					var returnTs2 = "<a href='http://www.treeid/code_" + this.code + _id + 
						"  onclick='changeCss(this,\"towrite3\");updated()'>" +   this.name 
						//+"<font style='position:absolute; right:155px;' >[" + cutStr(this.zt.replace('概念',''),4)  + "]</font>" 
						//+"<font style='position:absolute; right:95px;'>" + ChineseToNumber(lz.replace('龙',''))  + "</font>"
						+lz
						+"<font style='position:absolute; right:"+zhangf2bq+";'>" + zf + "</font>" 
						+zr
						+"<font style='position:absolute; right:"+shijiltbq+";'>" + sjsz + "亿" + "</font></a>";
						//+"<font style='position:absolute; right:5px;' color=#FFA500>" + this.lb.replace('昨日','昨').replace('天',',') + "</font></a>";

					var returnTs="";


						if (this.zt.length > 0) {
							 returnTs = returnTs2;
							} else {
								returnTs = returnTs1;
							}

					return(returnTs); //FFA500
				}},
				]}]}; 
				
				
				var html2 = json2html.transform(data2, transform_aa2);		
				div2 = document.getElementById('towrite3');
				div2.innerHTML = div2.innerHTML + html2.replace(/\[\]/g,"");
				div2.style.whiteSpace = "nowrap"; 	
				}
			}

			/*
			* param str 要截取的字符串
			* param L 要截取的字节长度，注意是字节不是字符，一个汉字两个字节
			* return 截取后的字符串
			*/
			function cutStr(str,L){    
				var result = '',
					strlen = str.length, // 字符串长度
					chrlen = str.replace(/[^\x00-\xff]/g,'**').length; // 字节长度

				if(chrlen<=L){return str;}
				
				for(var i=0,j=0;i<strlen;i++){
					var chr = str.charAt(i);
					if(/[\x00-\xff]/.test(chr)){
						j++; // ascii码为0-255，一个字符就是一个字节的长度
					}else{
						j+=2; // ascii码为0-255以外，一个字符就是两个字节的长度
					}
					if(j<=L){ // 当加上当前字符以后，如果总字节长度小于等于L，则将当前字符真实的+在result后
						result += chr;
					}else{ // 反之则说明result已经是不拆分字符的情况下最接近L的值了，直接返回
						return result;
					}
				}
			}
			

			function ChineseToNumber(chnStr) {
				var chnNumChar = { 零:0,一:1,二:2,三:3,四:4,五:5,六:6,七:7,八:8,九:9 };
				var chnNameValue = {
						十:{value:10, secUnit:false},
						百:{value:100, secUnit:false},
						千:{value:1000, secUnit:false},
						万:{value:10000, secUnit:true},
						亿:{value:100000000, secUnit:true}
				};
				var expNumChar= {十:10,十一:11,十二:12,十三:13,十四:14,十五:15,十六:16,十七:17,十八:18,十九:19,廿:20,廿一:21,廿二:22,廿三:23,廿四:24,廿五:25,廿六:26,廿七:27,廿八:28,廿九:29 };
				var isexpNumChar = expNumChar[chnStr];
				if(expNumChar[chnStr]) {
				return expNumChar[chnStr];
				}

				var rtn = 0;
					var section = 0;
					var number = 0;
					var secUnit = false;
					var str = chnStr.split('');
					for(var i = 0; i < str.length; i++){
						var num = chnNumChar[str[i]];
						if(typeof num !== 'undefined'){
							number = num;
							if(i === str.length - 1){
								section += number;
							}
						}else{
				var cunit = chnNameValue[str[i]];

				if(typeof cunit == 'undefined') {
				return false;
				}

				var unit = chnNameValue[str[i]].value;
							secUnit = chnNameValue[str[i]].secUnit;
							if(secUnit){
								section = (section + number) * unit;
								rtn += section;
								section = 0;
							}else{
								section += (number * unit);
							}
							number = 0;
						}
					}
				
				var nn = rtn + section;
				if(nn==0) return ''
				else return rtn + section;
			}
			
			function updatez() {
				var dmz = bdm; 			 					
				var url3 = "https://apphq.longhuvip.com/w1/api/index.php?Order=1&ZZ=1&a=PlateIntroduction&st=30&c=ZhiShuRanking&Index=0&apiv=w24&Type=2&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&PlateID=" + dmz + "&"; 								
				if (window.XMLHttpRequest) {
				xmlHttp4 = new XMLHttpRequest();				
				} else {
				xmlHttp4 = new ActiveXObject("Microsoft.XMLHTTP");				
				}
				xmlHttp4.onreadystatechange = writeSource4;				
				xmlHttp4.open("GET", url3, true);
				xmlHttp4.send(null);				
			}
			
			function writeSource4() { 			
				if (xmlHttp4.readyState == 4) {                  	
				var data3 = xmlHttp4.responseText
				//document.write(data3);
				data3 = data3.replace(/ /g,"").match(/\{\"List\":(\S*)\]\],\"/)[1] + ']]';
				data3 = data3.replace(/(\[\").*?(?=\])/g,function(word){ 
				str = word.match(/\[(\S*)/)[1]; 
				return '{"code":' + str.split(',')[0] + 
				',"name":' + str.split(',')[1] + 
				',"zf":'+str.split(',')[3] + 
				',"lzcs":'+str.split(',')[4]});
				
				data3 = '{\"list\":' + data3.replace(/\],\{/g,"},{").replace(/\]\]/g,"}]") + "}";				
				//document.write(data3);
				
				var transform_aa3 = [           
				{"tag":"p", children:function(){return(json2html.transform(this.list, transform_bb3));}}
				];
				
				var transform_bb3= 
				{"tag":"p", children:[
				{"tag":"p", children:[											
				{"tag": "p", "html":"<a href='http://www.treeid/code_${code}' onclick='changeCss(this,\"towrite3\");updated(this)'>${name}&nbsp;涨幅：${zf}%&nbsp;&nbsp;领涨：${lzcs}</a>"}, 
				]}]}; 
				
				var html3 = json2html.transform(data3, transform_aa3);	
				var bfyy = "<a style='padding-left:0px' href='javascript:void(0)' onclick='updateb()'>【原因】</a>";
				var qb = "<a style='float:right;margin-right:55px;' href='javascript:void(0)' onclick='update(" + "0" + ")'>全部</a>";				
				div2 = document.getElementById('towrite3');				
				//div2.innerHTML = '<h4>' + bkm + qb + '</h4>';
				div2.innerHTML = '<h4>' + bkm + bfyy + qb + '</h4>';					
				div2.innerHTML = div2.innerHTML + html3;
				div2.style.whiteSpace = "nowrap";
				}					
			}
			
			function updateb() {
				y = 0;	
				var dm = bdm; 			 
				//div2 = document.getElementById('towrite2');				
				//div2.innerHTML = '<h3>' + bk + '</h3>';
				var url4 = "https://apphq.longhuvip.com/w1/api/index.php?a=GetBaseFaceListZDEvnArtNew&apiv=w26&c=ZhiShuL2Data&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&StockID=" + dm;				
				var url5 = "https://apphis.longhuvip.com/w1/api/index.php?a=GetDayBaseFaceListZDEvnArt&st=10&c=ZhiShuKLine&VerSion=5.13.0.2&PhoneOSNew=1&DeviceID=ffffffff-2423-5c91-20a2-00000cae2a18&apiv=w26&StockID=" + dm; 								
				if (window.XMLHttpRequest) {
				xmlHttp41 = new XMLHttpRequest();				
				} else {
				xmlHttp41 = new ActiveXObject("Microsoft.XMLHTTP");				
				}
				xmlHttp41.onreadystatechange = writeSource5;				
				xmlHttp41.open("GET", url4, true);
				xmlHttp41.send(null);
				
				if (window.XMLHttpRequest) {
				xmlHttp5 = new XMLHttpRequest();				
				} else {
				xmlHttp5 = new ActiveXObject("Microsoft.XMLHTTP");				
				}
				xmlHttp5.onreadystatechange = writeSource5;				
				xmlHttp5.open("GET", url5, true);
				xmlHttp5.send(null);								
			}
			
			function writeSource5() { 			
				if (xmlHttp41.readyState == 4 && xmlHttp5.readyState == 4) { 
					var data = xmlHttp41.responseText
					data = '{"List":[' + data + ']}';
					//document.write(data);	
					var fh = "<a style='padding-left:10px' href='javascript:void(0)' onclick='update(" + "0" + ")'>【返回】</a>";
					var zz = "<a style='float:right;margin-right:60px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";				
					div2 = document.getElementById('towrite3');				
					div2.innerHTML = '<h4>' + bkm + fh + zz + '</h4>';	
						
					if(data.indexOf('"Date":""') == -1)
					{
						var rq = data.match(/\"Date\":\"(\S*)\",\"/)[1];
						var day = new Date();
						gt = day.getTime();			
						mymonth = day.getMonth()+1;
						myday = day.getDate();
						if(mymonth >= 10){mymonth = mymonth;}else{mymonth = "0" + mymonth;}
						if(myday >= 10){myday = myday;}else{myday = "0" + myday;}
						tt = day.getFullYear() + "-" + mymonth + "-" + myday;													
						if(rq == tt){
							var transform_aa = [           
							{"tag":"p", children:function(){return(json2html.transform(this.List, transform_bb));}}
							];
							
							var transform_bb= 
							{"tag":"p", children:[
							{"tag":"li", children:[							
							{"tag": "b", "html":"${Date}：${BoomReason}"},
							{"tag": "p", "html":"${Title}"}, 								
							]}]}; 
							
							var html = json2html.transform(data, transform_aa);																						
							div2.innerHTML = div2.innerHTML + html;
						}
					}
					
					var data1 = xmlHttp5.responseText
					//document.write(data);				
					if(data1.indexOf('\"List\":[]') == -1)
					{
						var transform_aa = [           
						{"tag":"p", children:function(){return(json2html.transform(this.List, transform_bb));}}
						];
						
						var transform_bb= 
						{"tag":"p", children:[
						{"tag":"li", children:[							
						{"tag": "b", "html":"${Date}：${BoomReason}"},
						{"tag": "p", "html":"${Title}"}, 								
						]}]}; 
						
						var html = json2html.transform(data1, transform_aa);					
						<!-- var fh = "<a style='padding-left:0px' href='javascript:void(0)' onclick='update(" + "0" + ")'>【返回】</a>"; -->
						<!-- var zz = "<a style='float:right;margin-right:60px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";				 -->
						<!-- div2 = document.getElementById('towrite3');				 -->
						<!-- div2.innerHTML = '<h4>' + bkm + fh + zz + '</h4>';													 -->
						div2.innerHTML = div2.innerHTML + html;
					}
					else if(data1.indexOf('\"List\":[]') > -1 && data.indexOf('"Date":""') > -1)
					{
						<!-- var fh = "<a style='padding-left:10px' href='javascript:void(0)' onclick='update(" + "0" + ")'>【返回】</a>"; -->
						<!-- var zz = "<a style='float:right;margin-right:60px;' href='javascript:void(0)' onclick='updatez()'>最正宗</a>";				 -->
						<!-- div2 = document.getElementById('towrite3');				 -->
						<!-- div2.innerHTML = '<h4>' + bkm + fh + zz + '</h4>';	 -->
						div2.innerHTML = div2.innerHTML + "暂无数据";	
					}	
					div2.style.whiteSpace = "normal";  //折行
				}					
			}
			
			function ranking(){			
				var alist = document.getElementById("towrite2").getElementsByTagName("a");				
				for(var i = 0; i < alist.length; i++){
					yy = yy.replace(/ /g,"");
					var bk = alist[i].id;
					var y1 = "";
					var y2 = "";
					if(yy.indexOf("+")>-1){
						y1 = yy.split("+")[0];
						y2 = yy.split("+")[1];
					}else if(yy.indexOf("(")>-1){
						y1 = yy.split("(")[0];
						y2 = yy.split("(")[1].split(")")[0];
					}else{
						y1 = yy;
					}
					
					if(bk != ""){					
						if(y1 == bk || y2 == bk){
							
							alist[i].style.color = "#FFA500";
						}
					}					
				}				
			}
			
		</script>
	</head>
	<body>
		<div id="towriter" class="fixedBox">
			<div id="towrite1" ></div>
			<div id="towrite" style="margin-top:-10px">				
				<!-- <div id="towrite2" style="border: 1px solid #E5E5E5; float: left;"></div> -->
				<div id="towrite2" class="fixedBox" style="position:relative; float:left;"></div>
				<div id="towrite3" class="fixedBox" style="position:relative; float:left;"></div>			
			</div>
		</div>	
	</body>
</html>